<HTML>
<head>
<title>I2C Slave</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
UNKNOWN {
	FONT-SIZE: small; COLOR: #000000; FONT-FAMILY: verdana, sans-serif
}
BODY {
	FONT-SIZE: small; FONT-FAMILY: verdana, sans-serif
}
pre {background:#eeeeee;border:1px solid #777777;padding:4px}

</style>
</head>
<BODY BGCOLOR=#FFFFFF >
<CENTER>
  <h1>I2C Slave </h1>
</CENTER>
<h2>Revision History</h2>
<p>0.2: first version<br>
0.3: bugfixing timing problems with hardware masters, changed file structure<br>
0.4: bugfixing support for slave sending multiple bytes, adding Spartan3 Starter Kit project </p>
<h2>Description</h2>
<p>This project provides an I2C slave entity for standard and fast mode transfer. It was tested with an ARM PXA hardware master in fast mode (400 kBit/s) and a HCS08 master with standard mode (100 kBit/s). Lower frequencies are possible. See the sources for detailed description and the PCA9555 implementation for an example how to use it. Device utilization on the Cyclone I (EP1C6Q240C8) for the I2C slave and the PCA9555 is 296 (151 for the I2C entity) logic elements out of 5,980 (5%). For the Spartan 3 (xc3s200-4ft256) the device utilization is 249 LUTs out of 3,840 (6%).</p>
<h2>Files</h2>
<h3> bench/vhdl/slave_testbench.vhdl</h3>
<p>Testbench for the i2c_slave entity </p>
<h3>rtl/vhdl/i2c_slave.vhdl</h3>
<p>i2c_slave entity implementation. </p>
<h3> rtl/vhdl/pca9555.vhdl</h3>
<p>A limited (no interrupts) implementation of the <a href="http://www.nxp.com/acrobat_download/datasheets/PCA9555_6.pdf">PCA9555 GPIO IC</a> . </p>
<h3> rtl/vhdl/t_rex_test.vhdl</h3>
<p>Test for the <A href="http://www.terasic.com.tw/cgi-bin/page/archive.pl?Language=English&CategoryNo=39&No=14">Terasic   TREX C1 Multimedia Development Kit</A> </p>
<h3>rtl/vhdl/spartan3_test.vhdl</h3>
<p>Test for the <a href="http://www.digilentinc.com/Products/Detail.cfm?Prod=S3BOARD">Spartan 3 Start Kit</a> </p>
<h3>sw/*</h3>
<p>Test for the Softec <A href="products.html?type=detail&title=PK-HCS08GB60">PK-HCS08GB60</A> starter kit with the Freescale MC9S08GB60, which sends and receives data from the T-Rex board and the Spartan 3 board with its hardware I2C master, compiled with <a href="http://www.imagecraft.com/software/mdevtools.html">ICC08</a> . Output file test.hex in Intel Hex included. </p>
<h3> syn/altera/*</h3>
<p>Project files for Quartus II 6.</p>
<h3>syn/xilinx/*</h3>
<p>Project files for ISE Web Pack 8.2.</p>
<h2>Sampled SDA and SCL waveforms </h2>
These waveforms were sampled with a logic analyzer while the PK-HCS08GB60 starter kit and the TREX board were connected and runs the included programs. 
<p>The HCS08 sends the address 0x26, 0x07 for configuring the config register in the emulated PCA9555 and a 0 byte for setting the direction for port 1 to output: </p>
<p><img src="sample1.gif" width="755" height="86"></p>
<p>The address 0x26, 0x03 for output port 1 and some bit pattern, which is incremented with 8 Hz, is sent to the PCA9555. The contents of port 1 is displayed with the LEDs on the TREX board </p>
<p><img src="sample2.gif" width="694" height="86"></p>
<p>The address 0x26, 0x00 for reading port 0 is sent. After this a repeated start bit is sent, address 0x26, with read bit set. The PCA9555 sends the answer, which is the state of the push buttons and the dip switches. </p>
<p><img src="sample3.gif" width="939" height="86"></p>
<p>&nbsp;</p>
</body>
</html>
